﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DnPakExplorer.Forms {
	public partial class CharacterEditorForm : Form {

		CharacterInfo mInfo;

		public CharacterInfo CharacterInfo {
			get { return mInfo; }
		}

		public CharacterEditorForm() {
			InitializeComponent();
			Dntable jobTable = DnResourceUtil.JobTable;
			for (int r=0; r<jobTable.RecordCount; r++) {
				if ((bool)jobTable[r, "_Service"]) {
					mComboxJob.Items.Add(new KeyValuePair<int, string>(jobTable.GetKey(r), Util.FindUIString((int)jobTable[r, 0])));
				}
			}
			mComboxJob.SelectedIndex = 0;
		}

		private void button2_Click(object sender, EventArgs e) {
			DialogResult = System.Windows.Forms.DialogResult.Cancel;
			Close();
		}

		private void button1_Click(object sender, EventArgs e) {
			mInfo = new DnPakExplorer.CharacterInfo();
			mInfo.name = mTextCharacter.Text;
			mInfo.job = ((KeyValuePair<int, string>)mComboxJob.SelectedItem).Key;
			mInfo.level = int.Parse(mComboxLevel.Text);
			mInfo.heroLevel = int.Parse(mComboxHeroLevel.Text);
			DialogResult = System.Windows.Forms.DialogResult.OK;
			Close();
		}
	}
}
